<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>分配权限</title>
    <link href="/favicon.ico"   rel="shortcut"  />
    <link href="/Public/wxCMS/css/bootstrap.min.css" rel="stylesheet">
    <link href="/Public/wxCMS/css/styles.css" rel="stylesheet">
    <link href="/Public/wxCMS/css/home.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <script src="/Public/wxCMS/js/html5shiv.js"></script>
    <script src="/Public/wxCMS/js/respond.min.js"></script>
    <![endif]-->



    <script src="/Public/wxCMS/js/jquery-1.11.1.min.js"></script>
    <script src="/Public/wxCMS/js/layer.js" type="text/javascript"></script>
    <script src="/Public/wxCMS/js/user-action.js"></script>



</head>

<body>
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#"><span>实+网</span>后台管理系统</a>
            <ul class="user-menu">
                <li class="dropdown pull-right">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span> <?php echo ($_SESSION['user']['name']); ?>  <span class="caret"></span></a>
                    <ul class="dropdown-menu" role="menu">
                        <li id="user-info" data-index="<?php echo ($_SESSION['user']['id']); ?>"><a href="javascript:;"><span class="glyphicon glyphicon-user"></span> 重置密码</a></li>
                        <li id="user-logout" data-index="<?php echo ($_SESSION['user']['id']); ?>"><a href="javascript:;"><span class="glyphicon glyphicon-log-out"></span> 退出</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div><!-- /.container-fluid -->
</nav>

<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
    <form role="search">
        <div class="form-group">

        </div>
    </form>
    <ul class="nav menu">
        <li><a href="<?php echo U('/Home/Index/index');?>"><span class="glyphicon glyphicon-dashboard"></span> 首页</a></li>
        <li class=""><a href="<?php echo U('/Home/Slider/index');?>"><span class="glyphicon glyphicon-th"></span> 轮播图管理</a></li>
        <li class="parent ">
            <a href="#">
                <span class="glyphicon glyphicon-list"></span> 成品展示管理 <span data-toggle="collapse" href="#sub-item-1" class="icon pull-right"><em class="glyphicon glyphicon-s glyphicon-plus"></em></span>
            </a>
            <ul class="children collapse" id="sub-item-1">
                <li>
                    <a class="" href="<?php echo U('/Home/Show/aderShow');?>?id=1">
                        <span class="glyphicon glyphicon-share-alt"></span> 休闲照
                    </a>
                </li>
                <li>
                    <a class="" href="<?php echo U('/Home/Show/aderShow');?>?id=2">
                        <span class="glyphicon glyphicon-share-alt"></span> 儿童照
                    </a>
                </li>
                <li>
                    <a class="" href="<?php echo U('/Home/Show/aderShow');?>?id=3">
                        <span class="glyphicon glyphicon-share-alt"></span> 婚纱照
                    </a>
                </li>
            </ul>
        </li>
        <li><a href="<?php echo U('/Home/Product/index');?>"><span class="glyphicon glyphicon-list"></span> 背景列表</a></li>
        <li><a href="<?php echo U('/Home/Decorate/index');?>"><span class="glyphicon glyphicon-list"></span> 装饰列表</a></li>
        <!--  <li class=""><a href="<?php echo U('/Home/Client/index');?>"><span class="glyphicon glyphicon-list"></span> 客户列表</a></li>-->
        <li><a href="<?php echo U('/Home/PhotoBox/index');?>"><span class="glyphicon glyphicon-list"></span> 相框相册管理</a></li>
        <li><a href="<?php echo U('/Home/Orders/index');?>"><span class="glyphicon glyphicon-list"></span> 订单列表</a></li>
        <li   class=""><a href="<?php echo U('/Home/applyRefund/index');?>"><span class="glyphicon glyphicon-list"></span> 退款订单</a></li>
        <li role="presentation" class="divider"></li>
        <li class="parent active">
            <a href="#">
                <span class="glyphicon glyphicon-list"></span> 系统管理 <span data-toggle="collapse" href="#sub-item-2" class="icon pull-right"><em class="glyphicon glyphicon-s glyphicon-plus"></em></span>
            </a>
            <ul class="children collapse in" id="sub-item-2">
                <li>
                    <a class="" href="<?php echo U('/Home/Staff/index');?>">
                        <span class="glyphicon glyphicon-share-alt"></span> 员工账号管理
                    </a>
                    <a class="" href="<?php echo U('/Home/CheckAuth/index');?>">
                        <span class="glyphicon glyphicon-share-alt"></span> 用户组管理
                    </a>
                    <a class="" href="<?php echo U('/Home/CheckAuth/auth_list');?>">
                        <span class="glyphicon glyphicon-share-alt"></span> 权限列表
                    </a>
                </li>
                <!-- <li>
                     <a class="" href="javascript:;" id="pay-setting">
                         <span class="glyphicon glyphicon-share-alt"></span> 支付方式管理
                     </a>
                 </li>-->
            </ul>
        </li>
    </ul>
</div><!--/.sidebar-->
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main">
    <div class="row">
        <ol class="breadcrumb">
            <li><a href="<?php echo U('/Home/Index/index');?>"><span class="glyphicon glyphicon-home"></span></a></li>
            <li class="active">首页</li>
        </ol>
    </div><!--/.row-->


    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">用户组->[<?php echo ($groupInfo["title"]); ?>]->分配权限
                </div>
                <div class="panel-body">


                    <?php if(is_array($rule)): $i = 0; $__LIST__ = $rule;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><div class="form-group">
                        <label for="name"><?php echo ($vo["module"]); ?></label>
                        <div>
                            <?php if(is_array($vo['list_rule'])): $i = 0; $__LIST__ = $vo['list_rule'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$ve): $mod = ($i % 2 );++$i;?><label class="checkbox-inline" style="margin-left: 30px;">

                                    <?php if(in_array(($ve['id']), is_array($ruleArray)?$ruleArray:explode(',',$ruleArray))): ?><input type="checkbox" name="checkbox" value="<?php echo ($ve["id"]); ?>" checked ><?php echo ($ve["title"]); ?>
                                        <?php else: ?>
                                        <input type="checkbox" name="checkbox" value="<?php echo ($ve["id"]); ?>"  ><?php echo ($ve["title"]); endif; ?>

                                </label><?php endforeach; endif; else: echo "" ;endif; ?>
                        </div>
                            </div><?php endforeach; endif; else: echo "" ;endif; ?>



                </div>
                <div class="modal-footer">

                    <button type="button" class="btn btn-primary" id="add-rule" >
                        分配权限
                    </button>
                </div>
            </div>
        </div>
    </div><!--/.row-->



</div>	<!--/.main-->


<script>
    $('#add-rule').click(function(){
        var chk_value =[];
        $('input[name="checkbox"]:checked').each(function(){
            chk_value.push($(this).val());
        });
        if(chk_value.length==0){
            layer.msg('请选择权限',{icon:2});return;
        }

        var id="<?php echo ($groupInfo['id']); ?>";
        $.post("<?php echo U('save_rule');?>",{id:id,rule:chk_value},function(result){
                if(!result.success){
                    layer.msg(result.message,{icon:2});return;
                }
            layer.msg(result.message,{icon:1},function(){
                window.location.reload();
            });

        });
    })
</script>
</body>

</html>